#pragma once
#include <map>
#include <string>
#include <list>
#include "clcomnotify.h"
#include <mutex>
#include <thread>

#define SEND_GAP 1000

using namespace std;

class CRealNotify :
    public CLComNotify
{
private:
    CRealNotify(int nKeyValue);
public:
    ~CRealNotify();
public:
    void AddNotifyInfo(const char* info, int datalen, int nType);
    void AddNotifyInfo(const NOTIFYNODE& notify);
public:
    static CRealNotify* GetErrorInstance(int nKey);
	static void InitMsgNotify(int nModule, NOTIFYINFO& initInfo);

private:
    friend void ThreadPostNotify(void* pra);
private:
    std::map<int, std::list<PNOTIFYNODE>> _mapError;

    std::map<int, qint64> _mapTicks;

	NOTIFYINFO _initInfo;

	int _nModule;

    static thread*					s_pThread;

    mutex m_locker;
private:
    static map<int, CRealNotify*> cls_mapInstance;
};
